/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DynamicToolbarWizard.java
 *
 * Created on 15.Haz.2009, 15:21:12
 */

package com.meraklisina.latexeditor.wizard ;

import java.awt.event.ActionEvent ;
import java.io.BufferedWriter ;
import java.io.File ;
import java.io.FileInputStream ;
import java.io.FileNotFoundException ;
import java.io.FileOutputStream ;
import java.io.FileWriter ;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.OutputStream ;
import java.util.ArrayList ;

import javax.swing.JDialog ;

import com.meraklisina.latexeditor.LatexButton ;
import com.meraklisina.latexeditor.LatexToolBar ;
import com.meraklisina.latexeditor.ToolBarConfigReader ;

/**
 *
 * @author Acer
 */
public class DynamicToolbarWizard extends javax.swing.JPanel
{
    private JDialog dialog ;

    /** Creates new form DynamicToolbarWizard */
    public DynamicToolbarWizard( JDialog d )
    {
        this.dialog = d ;
        this.initComponents( ) ;
    }

    private static void copyfile( String srFile, String dtFile )
    {
        try
        {
            File f1 = new File( srFile ) ;
            File f2 = new File( dtFile ) ;
            InputStream in = new FileInputStream( f1 ) ;

            //For Append the file.
            //      OutputStream out = new FileOutputStream(f2,true);

            //For Overwrite the file.
            OutputStream out = new FileOutputStream( f2 ) ;

            byte[ ] buf = new byte[ 1024 ] ;
            int len ;
            while( ( len = in.read( buf ) ) > 0 )
            {
                out.write( buf, 0, len ) ;
            }
            in.close( ) ;
            out.close( ) ;
            System.out.println( "File copied." ) ;
        }
        catch( FileNotFoundException ex )
        {
            System.out.println( ex.getMessage( ) + " in the specified directory." ) ;
            System.exit( 0 ) ;
        }
        catch( IOException e )
        {
            System.out.println( e.getMessage( ) ) ;
        }
    }

    private String generateConfigXml( String toolbarPath )
    {
        String headerTag = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
        String buttonsTag = "<Buttons>" ;
        String buttonTag = "<Button>" ;
        /*String nameTag = "<name>{0}</name>";
        String tooltipTag = "<tooltip>{1}</tooltip>";
        String iconpathTag = "<iconpath>{2}</iconpath>";
        String prefixTag = "<prefix>{3}</prefix>";
        String suffixTag = "<suffix>{4}</suffix>";
        String exampleCommandTag = "<exampleCommand>{5}</exampleCommand>";*/
        String buttonEndTag = "</Button>" ;
        String buttonsEndTag = "</Buttons>" ;

        String returnXml = headerTag + buttonsTag ;

        for( int i = 0; i < this.latexButtonCollection.size( ); i++ )
        {
            returnXml += buttonTag ;
            LatexButton btn = this.latexButtonCollection.get( i ) ;

            String ext = btn.getIconPath( ).substring( btn.getIconPath( ).lastIndexOf( "." ) ) ;
            String newPath = toolbarPath + "/icons/" + btn.getName( ).trim( ) + ext ;
            DynamicToolbarWizard.copyfile( btn.getIconPath( ), newPath ) ;

            returnXml += "<name>" + btn.getName( ).trim( ) + "</name>" ;//String.format(nameTag, btn.getName().trim());
            returnXml += "<tooltip>" + btn.getToolTipText( ) + "</tooltip>" ;//String.format(tooltipTag, btn.getToolTipText());
            returnXml += "<iconpath>" + "/icons/" + btn.getName( ).trim( ) + ext + "</iconpath>" ;//String.format(iconpathTag, "/icons/" + btn.getName().trim() + ext);
            returnXml += "<prefix>" + btn.getPrefix( ) + "</prefix>" ;//String.format(prefixTag, btn.getPrefix());
            returnXml += "<suffix>" + btn.getSuffix( ) + "</suffix>" ;//String.format(suffixTag, btn.getSuffix());
            returnXml += "<exampleCommand>" + btn.getExpressionTemplate( ) + "</exampleCommand>" ;//String.format(exampleCommandTag, btn.getExpressionTemplate());

            returnXml += buttonEndTag ;
        }

        returnXml += buttonsEndTag ;
        return returnXml ;
    }

    private String generateSummaryMessage( )
    {
        String message = "Toolbar Name: " + this.toolbarNameTxt.getText( ).trim( ) + "\n" ;
        for( int i = 0; i < this.latexButtonCollection.size( ); i++ )
        {
            LatexButton btn = this.latexButtonCollection.get( i ) ;

            message += "\nName: " + btn.getName( ) + "\n" ;
            message += "Tooltip: " + btn.getToolTipText( ) + "\n" ;
            message += "IconPath: " + btn.getIconPath( ) + "\n" ;
            message += "Prefix: " + btn.getPrefix( ) + "\n" ;
            message += "Suffix: " + btn.getSuffix( ) + "\n" ;
            message += "Example Command: " + btn.getExpressionTemplate( ) + "\n" ;
        }
        return message ;
    }

    private void newActionActionPerformed( ActionEvent evt, LatexButton btn, int index )
    {
        JDialog dialog = new JDialog( ) ;
        ButtonEditor buttonEditor = new ButtonEditor( dialog ) ;
        buttonEditor.setFields( btn ) ;
        dialog.getContentPane( ).add( buttonEditor ) ;

        dialog.setTitle( "Button Editor" ) ;
        dialog.setSize( 550, 450 ) ;
        //dialog.setLocation((int)mainPanel.getLocation().getX() + 200, (int)mainPanel.getLocation().getY() + 200);
        dialog.setResizable( true ) ;
        dialog.setModal( true ) ;
        dialog.setVisible( true ) ;

        while( buttonEditor.hasFocus( ) )
        {
            //wait until button created
        }

        if( ButtonEditor.getLatexButton( ) != null )
        {
            this.latexButtonCollection.remove( index ) ;
            this.latexButtonCollection.add( index, btn ) ;
            //countTxt.setText(String.valueOf(latexButtonCollection.size()));
            this.buttonsCombo.removeItemAt( index ) ;
            this.buttonsCombo.insertItemAt( btn.getName( ), index ) ;
            this.buttonsCombo.setSelectedIndex( index ) ;
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents( )
    {

        this.tabbedPane = new javax.swing.JTabbedPane( ) ;
        this.generalPanel = new javax.swing.JPanel( ) ;
        this.header1 = new javax.swing.JPanel( ) ;
        this.label1 = new javax.swing.JLabel( ) ;
        this.label2 = new javax.swing.JLabel( ) ;
        this.jLabel3 = new javax.swing.JLabel( ) ;
        this.jLabel4 = new javax.swing.JLabel( ) ;
        this.nextBtn1 = new javax.swing.JButton( ) ;
        this.toolbarNameTxt = new javax.swing.JTextField( ) ;
        this.jLabel1 = new javax.swing.JLabel( ) ;
        this.errLbl = new javax.swing.JLabel( ) ;
        this.jLabel2 = new javax.swing.JLabel( ) ;
        this.cancelBtn1 = new javax.swing.JButton( ) ;
        this.iconsPanel = new javax.swing.JPanel( ) ;
        this.header2 = new javax.swing.JPanel( ) ;
        this.label3 = new javax.swing.JLabel( ) ;
        this.label4 = new javax.swing.JLabel( ) ;
        this.jLabel5 = new javax.swing.JLabel( ) ;
        this.jLabel6 = new javax.swing.JLabel( ) ;
        this.nextBtn2 = new javax.swing.JButton( ) ;
        this.backBtn1 = new javax.swing.JButton( ) ;
        this.newAction = new javax.swing.JButton( ) ;
        this.buttonsCombo = new javax.swing.JComboBox( ) ;
        this.jLabel9 = new javax.swing.JLabel( ) ;
        this.jScrollPane2 = new javax.swing.JScrollPane( ) ;
        this.actionDetailTxt = new javax.swing.JTextArea( ) ;
        this.editActionBtn = new javax.swing.JButton( ) ;
        this.removeActionBtn = new javax.swing.JButton( ) ;
        this.cancelBtn2 = new javax.swing.JButton( ) ;
        this.errLbl3 = new javax.swing.JLabel( ) ;
        this.summaryPanel = new javax.swing.JPanel( ) ;
        this.header3 = new javax.swing.JPanel( ) ;
        this.label5 = new javax.swing.JLabel( ) ;
        this.label6 = new javax.swing.JLabel( ) ;
        this.jLabel7 = new javax.swing.JLabel( ) ;
        this.jLabel8 = new javax.swing.JLabel( ) ;
        this.createButton = new javax.swing.JButton( ) ;
        this.backBtn2 = new javax.swing.JButton( ) ;
        this.jScrollPane1 = new javax.swing.JScrollPane( ) ;
        this.summaryTxt = new javax.swing.JTextArea( ) ;
        this.errLbl2 = new javax.swing.JLabel( ) ;
        this.cancelBtn3 = new javax.swing.JButton( ) ;
        this.jPanel1 = new javax.swing.JPanel( ) ;
        this.jPanel2 = new javax.swing.JPanel( ) ;
        this.header4 = new javax.swing.JPanel( ) ;
        this.label7 = new javax.swing.JLabel( ) ;
        this.label8 = new javax.swing.JLabel( ) ;
        this.successMessage = new javax.swing.JLabel( ) ;
        this.resultDetailMessage = new javax.swing.JLabel( ) ;
        this.cancelBtn4 = new javax.swing.JButton( ) ;

        this.tabbedPane.setEnabled( false ) ;
        this.tabbedPane.setName( "tabbedPane" ) ; // NOI18N

        this.generalPanel.setName( "generalPanel" ) ; // NOI18N

        this.header1.setBackground( new java.awt.Color( 153, 153, 255 ) ) ;
        this.header1.setName( "header1" ) ; // NOI18N

        this.label1.setName( "label1" ) ; // NOI18N

        this.label2.setName( "label2" ) ; // NOI18N

        this.jLabel3.setFont( new java.awt.Font( "Tahoma 12", 1, 12 ) ) ;
        this.jLabel3.setText( "General Toolbar Settings" ) ;
        this.jLabel3.setName( "jLabel3" ) ; // NOI18N

        this.jLabel4.setForeground( new java.awt.Color( 255, 255, 255 ) ) ;
        this.jLabel4.setText( "Please provide a name for new custom Latex toolbar." ) ;
        this.jLabel4.setName( "jLabel4" ) ; // NOI18N

        javax.swing.GroupLayout header1Layout = new javax.swing.GroupLayout( this.header1 ) ;
        this.header1.setLayout( header1Layout ) ;
        header1Layout.setHorizontalGroup( header1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header1Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header1Layout.createSequentialGroup( ).addComponent( this.jLabel3 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label2, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE ) ).addComponent( this.label1 ).addComponent( this.jLabel4 ) ).addContainerGap( ) ) ) ;
        header1Layout.setVerticalGroup( header1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header1Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.jLabel3 ).addGroup( header1Layout.createSequentialGroup( ).addComponent( this.label1 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label2 ) ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( this.jLabel4 ).addContainerGap( ) ) ) ;

        this.nextBtn1.setText( "Next ->" ) ;
        this.nextBtn1.setName( "nextBtn1" ) ; // NOI18N
        this.nextBtn1.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.nextBtn1ActionPerformed( evt ) ;
            }
        } ) ;

        this.toolbarNameTxt.setName( "toolbarNameTxt" ) ; // NOI18N

        this.jLabel1.setName( "jLabel1" ) ; // NOI18N

        this.errLbl.setForeground( new java.awt.Color( 255, 0, 0 ) ) ;
        this.errLbl.setName( "errLbl" ) ; // NOI18N

        this.jLabel2.setText( "Toolbar Name:" ) ;
        this.jLabel2.setName( "jLabel2" ) ; // NOI18N

        this.cancelBtn1.setText( "Cancel" ) ;
        this.cancelBtn1.setName( "cancelBtn1" ) ; // NOI18N
        this.cancelBtn1.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.cancelBtn1ActionPerformed( evt ) ;
            }
        } ) ;

        javax.swing.GroupLayout generalPanelLayout = new javax.swing.GroupLayout( this.generalPanel ) ;
        this.generalPanel.setLayout( generalPanelLayout ) ;
        generalPanelLayout.setHorizontalGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, generalPanelLayout.createSequentialGroup( ).addContainerGap( 414, Short.MAX_VALUE ).addComponent( this.nextBtn1 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.cancelBtn1 ).addContainerGap( ) ).addGroup( generalPanelLayout.createSequentialGroup( ).addGap( 18, 18, 18 ).addGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.errLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE ).addGroup( generalPanelLayout.createSequentialGroup( ).addGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING ).addComponent( this.jLabel2 ).addComponent( this.jLabel1 ) ).addGap( 29, 29, 29 ).addComponent( this.toolbarNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE ) ) ).addContainerGap( 194, Short.MAX_VALUE ) ).addComponent( this.header1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ) ) ;
        generalPanelLayout.setVerticalGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, generalPanelLayout.createSequentialGroup( ).addComponent( this.header1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.errLbl ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING ).addComponent( this.jLabel1 ).addGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.jLabel2 ).addComponent( this.toolbarNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ) ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 241, Short.MAX_VALUE ).addGroup( generalPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.nextBtn1 ).addComponent( this.cancelBtn1 ) ).addContainerGap( ) ) ) ;

        this.tabbedPane.addTab( "General", this.generalPanel ) ;

        this.iconsPanel.setName( "iconsPanel" ) ; // NOI18N

        this.header2.setBackground( new java.awt.Color( 153, 153, 255 ) ) ;
        this.header2.setName( "header2" ) ; // NOI18N

        this.label3.setName( "label3" ) ; // NOI18N

        this.label4.setName( "label4" ) ; // NOI18N

        this.jLabel5.setFont( new java.awt.Font( "Tahoma 12", 1, 12 ) ) ;
        this.jLabel5.setText( "Toolbar Action Buttons" ) ;
        this.jLabel5.setName( "jLabel5" ) ; // NOI18N

        this.jLabel6.setForeground( new java.awt.Color( 255, 255, 255 ) ) ;
        this.jLabel6.setText( "Please define the actions for the buttons in custom Latex toolbar." ) ;
        this.jLabel6.setName( "jLabel6" ) ; // NOI18N

        javax.swing.GroupLayout header2Layout = new javax.swing.GroupLayout( this.header2 ) ;
        this.header2.setLayout( header2Layout ) ;
        header2Layout.setHorizontalGroup( header2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header2Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header2Layout.createSequentialGroup( ).addComponent( this.jLabel5 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label4, javax.swing.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE ) ).addComponent( this.label3 ).addComponent( this.jLabel6 ) ).addContainerGap( ) ) ) ;
        header2Layout.setVerticalGroup( header2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header2Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.jLabel5 ).addGroup( header2Layout.createSequentialGroup( ).addComponent( this.label3 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label4 ) ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( this.jLabel6 ).addContainerGap( ) ) ) ;

        this.nextBtn2.setText( "Next ->" ) ;
        this.nextBtn2.setName( "nextBtn2" ) ; // NOI18N
        this.nextBtn2.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.nextBtn2ActionPerformed( evt ) ;
            }
        } ) ;

        this.backBtn1.setText( "<- Back" ) ;
        this.backBtn1.setName( "backBtn1" ) ; // NOI18N
        this.backBtn1.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.backBtn1ActionPerformed( evt ) ;
            }
        } ) ;

        this.newAction.setText( "Add New Action Button" ) ;
        this.newAction.setName( "newAction" ) ; // NOI18N
        this.newAction.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.newActionActionPerformed( evt ) ;
            }
        } ) ;

        this.buttonsCombo.setName( "buttonsCombo" ) ; // NOI18N
        this.buttonsCombo.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.buttonsComboActionPerformed( evt ) ;
            }
        } ) ;

        this.jLabel9.setText( "Existing Actions:" ) ;
        this.jLabel9.setName( "jLabel9" ) ; // NOI18N

        this.jScrollPane2.setName( "jScrollPane2" ) ; // NOI18N

        this.actionDetailTxt.setColumns( 20 ) ;
        this.actionDetailTxt.setEditable( false ) ;
        this.actionDetailTxt.setFont( new java.awt.Font( "Tahoma 11", 0, 12 ) ) ;
        this.actionDetailTxt.setRows( 5 ) ;
        this.actionDetailTxt.setName( "actionDetailTxt" ) ; // NOI18N
        this.jScrollPane2.setViewportView( this.actionDetailTxt ) ;

        this.editActionBtn.setText( "Edit Action" ) ;
        this.editActionBtn.setName( "editActionBtn" ) ; // NOI18N
        this.editActionBtn.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.editActionBtnActionPerformed( evt ) ;
            }
        } ) ;

        this.removeActionBtn.setText( "Remove" ) ;
        this.removeActionBtn.setName( "removeActionBtn" ) ; // NOI18N
        this.removeActionBtn.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.removeActionBtnActionPerformed( evt ) ;
            }
        } ) ;

        this.cancelBtn2.setText( "Cancel" ) ;
        this.cancelBtn2.setName( "cancelBtn2" ) ; // NOI18N
        this.cancelBtn2.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.cancelBtn2ActionPerformed( evt ) ;
            }
        } ) ;

        this.errLbl3.setForeground( java.awt.Color.red ) ;
        this.errLbl3.setName( "errLbl3" ) ; // NOI18N

        javax.swing.GroupLayout iconsPanelLayout = new javax.swing.GroupLayout( this.iconsPanel ) ;
        this.iconsPanel.setLayout( iconsPanelLayout ) ;
        iconsPanelLayout.setHorizontalGroup( iconsPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.header2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, iconsPanelLayout.createSequentialGroup( ).addGap( 201, 201, 201 ).addComponent( this.backBtn1 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ).addComponent( this.nextBtn2 ).addGap( 12, 12, 12 ).addComponent( this.cancelBtn2 ).addContainerGap( ) ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, iconsPanelLayout.createSequentialGroup( ).addContainerGap( 396, Short.MAX_VALUE ).addComponent( this.editActionBtn ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.removeActionBtn ).addContainerGap( ) ).addGroup( iconsPanelLayout.createSequentialGroup( ).addGap( 16, 16, 16 ).addComponent( this.jLabel9 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ).addComponent( this.buttonsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE ).addContainerGap( 285, Short.MAX_VALUE ) ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, iconsPanelLayout.createSequentialGroup( ).addGap( 16, 16, 16 ).addComponent( this.jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 540, Short.MAX_VALUE ).addContainerGap( ) ).addGroup( iconsPanelLayout.createSequentialGroup( ).addContainerGap( ).addComponent( this.newAction ).addContainerGap( 413, Short.MAX_VALUE ) ).addGroup( iconsPanelLayout.createSequentialGroup( ).addGap( 20, 20, 20 ).addComponent( this.errLbl3 ).addContainerGap( 546, Short.MAX_VALUE ) ) ) ;
        iconsPanelLayout.setVerticalGroup( iconsPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( iconsPanelLayout.createSequentialGroup( ).addComponent( this.header2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED ).addComponent( this.errLbl3 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.newAction ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addGroup( iconsPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.buttonsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addComponent( this.jLabel9 ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE ).addGap( 18, 18, 18 ).addGroup( iconsPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.removeActionBtn ).addComponent( this.editActionBtn ) ).addGap( 18, 18, 18 ).addGroup( iconsPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.nextBtn2 ).addComponent( this.backBtn1 ).addComponent( this.cancelBtn2 ) ).addGap( 11, 11, 11 ) ) ) ;

        this.tabbedPane.addTab( "Actions", this.iconsPanel ) ;

        this.summaryPanel.setName( "summaryPanel" ) ; // NOI18N

        this.header3.setBackground( new java.awt.Color( 153, 153, 255 ) ) ;
        this.header3.setName( "header3" ) ; // NOI18N

        this.label5.setName( "label5" ) ; // NOI18N

        this.label6.setName( "label6" ) ; // NOI18N

        this.jLabel7.setFont( new java.awt.Font( "Tahoma 12", 1, 12 ) ) ;
        this.jLabel7.setText( "Toolbar Summary" ) ;
        this.jLabel7.setName( "jLabel7" ) ; // NOI18N

        this.jLabel8.setForeground( new java.awt.Color( 255, 255, 255 ) ) ;
        this.jLabel8.setText( "Toolbar with information below will be created for Latex editor." ) ;
        this.jLabel8.setName( "jLabel8" ) ; // NOI18N

        javax.swing.GroupLayout header3Layout = new javax.swing.GroupLayout( this.header3 ) ;
        this.header3.setLayout( header3Layout ) ;
        header3Layout.setHorizontalGroup( header3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header3Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header3Layout.createSequentialGroup( ).addComponent( this.jLabel7 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addGroup( header3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header3Layout.createSequentialGroup( ).addGap( 113, 113, 113 ).addComponent( this.label6, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE ) ).addComponent( this.label5 ) ) ).addComponent( this.jLabel8 ) ).addContainerGap( ) ) ) ;
        header3Layout.setVerticalGroup( header3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header3Layout.createSequentialGroup( ).addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addGroup( header3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, header3Layout.createSequentialGroup( ).addComponent( this.label5 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label6 ) ).addComponent( this.jLabel7, javax.swing.GroupLayout.Alignment.TRAILING ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.jLabel8 ).addGap( 14, 14, 14 ) ) ) ;

        this.createButton.setText( "Create Toolbar" ) ;
        this.createButton.setName( "createButton" ) ; // NOI18N
        this.createButton.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.createButtonActionPerformed( evt ) ;
            }
        } ) ;

        this.backBtn2.setText( "<- Back" ) ;
        this.backBtn2.setName( "backBtn2" ) ; // NOI18N
        this.backBtn2.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.backBtn2ActionPerformed( evt ) ;
            }
        } ) ;

        this.jScrollPane1.setName( "jScrollPane1" ) ; // NOI18N

        this.summaryTxt.setColumns( 20 ) ;
        this.summaryTxt.setEditable( false ) ;
        this.summaryTxt.setFont( new java.awt.Font( "Tahoma 11", 0, 12 ) ) ;
        this.summaryTxt.setRows( 5 ) ;
        this.summaryTxt.setName( "summaryTxt" ) ; // NOI18N
        this.jScrollPane1.setViewportView( this.summaryTxt ) ;

        this.errLbl2.setForeground( new java.awt.Color( 255, 0, 0 ) ) ;
        this.errLbl2.setName( "errLbl2" ) ; // NOI18N

        this.cancelBtn3.setText( "Cancel" ) ;
        this.cancelBtn3.setName( "cancelBtn3" ) ; // NOI18N
        this.cancelBtn3.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.cancelBtn3ActionPerformed( evt ) ;
            }
        } ) ;

        javax.swing.GroupLayout summaryPanelLayout = new javax.swing.GroupLayout( this.summaryPanel ) ;
        this.summaryPanel.setLayout( summaryPanelLayout ) ;
        summaryPanelLayout.setHorizontalGroup( summaryPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, summaryPanelLayout.createSequentialGroup( ).addContainerGap( 309, Short.MAX_VALUE ).addComponent( this.backBtn2 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.createButton ).addGap( 2, 2, 2 ).addComponent( this.cancelBtn3 ).addContainerGap( ) ).addComponent( this.header3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addGroup( summaryPanelLayout.createSequentialGroup( ).addContainerGap( ).addComponent( this.jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 546, Short.MAX_VALUE ).addContainerGap( ) ).addGroup( summaryPanelLayout.createSequentialGroup( ).addContainerGap( ).addComponent( this.errLbl2 ).addContainerGap( 556, Short.MAX_VALUE ) ) ) ;
        summaryPanelLayout.setVerticalGroup( summaryPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, summaryPanelLayout.createSequentialGroup( ).addComponent( this.header3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addGap( 2, 2, 2 ).addComponent( this.errLbl2 ).addGap( 2, 2, 2 ).addComponent( this.jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE ).addGap( 18, 18, 18 ).addGroup( summaryPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ).addComponent( this.createButton ).addComponent( this.backBtn2 ).addComponent( this.cancelBtn3 ) ).addContainerGap( ) ) ) ;

        this.tabbedPane.addTab( "Summary", this.summaryPanel ) ;

        this.jPanel1.setName( "jPanel1" ) ; // NOI18N

        this.jPanel2.setName( "jPanel2" ) ; // NOI18N

        this.header4.setBackground( new java.awt.Color( 153, 153, 255 ) ) ;
        this.header4.setName( "header4" ) ; // NOI18N

        this.label7.setName( "label7" ) ; // NOI18N

        this.label8.setName( "label8" ) ; // NOI18N

        this.successMessage.setFont( new java.awt.Font( "Tahoma 12 12", 1, 12 ) ) ;
        this.successMessage.setText( "Success!" ) ;
        this.successMessage.setName( "successMessage" ) ; // NOI18N

        this.resultDetailMessage.setForeground( new java.awt.Color( 255, 255, 255 ) ) ;
        this.resultDetailMessage.setText( "Toolbar Successfully Created..." ) ;
        this.resultDetailMessage.setName( "resultDetailMessage" ) ; // NOI18N

        javax.swing.GroupLayout header4Layout = new javax.swing.GroupLayout( this.header4 ) ;
        this.header4.setLayout( header4Layout ) ;
        header4Layout.setHorizontalGroup( header4Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header4Layout.createSequentialGroup( ).addContainerGap( ).addGroup( header4Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header4Layout.createSequentialGroup( ).addComponent( this.successMessage ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addGroup( header4Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header4Layout.createSequentialGroup( ).addGap( 113, 113, 113 ).addComponent( this.label8, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE ) ).addComponent( this.label7 ) ) ).addComponent( this.resultDetailMessage ) ).addContainerGap( ) ) ) ;
        header4Layout.setVerticalGroup( header4Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( header4Layout.createSequentialGroup( ).addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addGroup( header4Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, header4Layout.createSequentialGroup( ).addComponent( this.label7 ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.label8 ) ).addComponent( this.successMessage, javax.swing.GroupLayout.Alignment.TRAILING ) ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.resultDetailMessage ).addGap( 14, 14, 14 ) ) ) ;

        this.cancelBtn4.setText( "Quit" ) ;
        this.cancelBtn4.setName( "cancelBtn4" ) ; // NOI18N
        this.cancelBtn4.addActionListener( new java.awt.event.ActionListener( )
        {
            public void actionPerformed( java.awt.event.ActionEvent evt )
            {
                DynamicToolbarWizard.this.cancelBtn4ActionPerformed( evt ) ;
            }
        } ) ;

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout( this.jPanel2 ) ;
        this.jPanel2.setLayout( jPanel2Layout ) ;
        jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( jPanel2Layout.createSequentialGroup( ).addContainerGap( ).addGroup( jPanel2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.header4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( this.cancelBtn4, javax.swing.GroupLayout.Alignment.TRAILING ) ).addContainerGap( ) ) ) ;
        jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( jPanel2Layout.createSequentialGroup( ).addGap( 72, 72, 72 ).addComponent( this.header4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ).addComponent( this.cancelBtn4 ).addContainerGap( 192, Short.MAX_VALUE ) ) ) ;

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout( this.jPanel1 ) ;
        this.jPanel1.setLayout( jPanel1Layout ) ;
        jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addComponent( this.jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ) ) ;
        jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( jPanel1Layout.createSequentialGroup( ).addComponent( this.jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addContainerGap( ) ) ) ;

        this.tabbedPane.addTab( "Result", this.jPanel1 ) ;

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout( this ) ;
        this.setLayout( layout ) ;
        layout.setHorizontalGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGap( 0, 591, Short.MAX_VALUE ).addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup( ).addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( this.tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 571, javax.swing.GroupLayout.PREFERRED_SIZE ).addContainerGap( ) ) ) ) ;
        layout.setVerticalGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGap( 0, 415, Short.MAX_VALUE ).addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup( ).addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( this.tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ).addContainerGap( ) ) ) ) ;
    }// </editor-fold>//GEN-END:initComponents

    private void nextBtn1ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_nextBtn1ActionPerformed
        if( FieldValidator.ValidateToolbarNameField( this.toolbarNameTxt.getText( ) ) )
        {
            this.errLbl.setText( "" ) ;
            this.tabbedPane.setSelectedIndex( this.tabbedPane.getSelectedIndex( ) + 1 ) ;
        }
        else
        {
            this.errLbl.setText( FieldValidator.getValidationMessage( ) ) ;
        }
    }//GEN-LAST:event_nextBtn1ActionPerformed

    private void nextBtn2ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_nextBtn2ActionPerformed
        if( this.buttonsCombo.getItemCount( ) > 0 )
        {
            this.tabbedPane.setSelectedIndex( this.tabbedPane.getSelectedIndex( ) + 1 ) ;
            this.summaryTxt.setText( this.generateSummaryMessage( ) ) ;
        }
        else
        {
            this.errLbl3.setText( "At least 1 action button should be created." ) ;
        }
    }//GEN-LAST:event_nextBtn2ActionPerformed

    private void backBtn1ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_backBtn1ActionPerformed
        this.tabbedPane.setSelectedIndex( this.tabbedPane.getSelectedIndex( ) - 1 ) ;
    }//GEN-LAST:event_backBtn1ActionPerformed

    private void newActionActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_newActionActionPerformed
        JDialog dia = new JDialog( ) ;
        ButtonEditor buttonEditor = new ButtonEditor( dia ) ;
        dia.getContentPane( ).add( buttonEditor ) ;

        dia.setTitle( "Button Editor" ) ;
        dia.setSize( 450, 350 ) ;
        //dialog.setLocation((int)mainPanel.getLocation().getX() + 200, (int)mainPanel.getLocation().getY() + 200);
        dia.setResizable( false ) ;
        dia.setModal( true ) ;
        dia.setVisible( true ) ;

        while( buttonEditor.hasFocus( ) )
        {
            //wait until button created
        }

        if( ButtonEditor.getLatexButton( ) != null )
        {
            this.latexButtonCollection.add( ButtonEditor.getLatexButton( ) ) ;
            //countTxt.setText(String.valueOf(latexButtonCollection.size()));
            this.buttonsCombo.addItem( ButtonEditor.getLatexButton( ).getName( ) ) ;
            this.buttonsCombo.setSelectedIndex( this.buttonsCombo.getItemCount( ) - 1 ) ;
        }
    }//GEN-LAST:event_newActionActionPerformed

    private void buttonsComboActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_buttonsComboActionPerformed
        int index = this.buttonsCombo.getSelectedIndex( ) ;
        LatexButton btn = this.latexButtonCollection.get( index ) ;

        String message = "Name: " + btn.getName( ) + "\n" ;
        message += "Tooltip: " + btn.getToolTipText( ) + "\n" ;
        message += "IconPath: " + btn.getIconPath( ) + "\n" ;
        message += "Prefix: " + btn.getPrefix( ) + "\n" ;
        message += "Suffix: " + btn.getSuffix( ) + "\n" ;
        message += "Example Command: " + btn.getExpressionTemplate( ) + "\n" ;

        this.actionDetailTxt.setText( message ) ;
    }//GEN-LAST:event_buttonsComboActionPerformed

    private void editActionBtnActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_editActionBtnActionPerformed
        if( ( this.buttonsCombo.getItemCount( ) > 0 ) && ( this.buttonsCombo.getSelectedIndex( ) >= 0 ) )
        {
            LatexButton btn = this.latexButtonCollection.get( this.buttonsCombo.getSelectedIndex( ) ) ;
            this.newActionActionPerformed( evt, btn, this.buttonsCombo.getSelectedIndex( ) ) ;
        }
    }//GEN-LAST:event_editActionBtnActionPerformed

    private void removeActionBtnActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_removeActionBtnActionPerformed
        /*if(buttonsCombo.getItemCount() > 0 && buttonsCombo.getSelectedIndex() >= 0){
            LatexButton btn = latexButtonCollection.remove(buttonsCombo.getSelectedIndex());
            if(btn != null){
                //buttonsCombo.remove(buttonsCombo.getSelectedIndex());
            }
        }*/
    }//GEN-LAST:event_removeActionBtnActionPerformed

    private void createButtonActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_createButtonActionPerformed
        //Create Toolbar Folder
        String executionPath = System.getProperty( "user.dir" ) ;
        executionPath = executionPath.replace( "\\", "/" ) ;
        String toolbarFolderPath = executionPath + "/" + this.toolbarNameTxt.getText( ).trim( ) ;
        File f = new File( toolbarFolderPath ) ;
        if( f.exists( ) == false )
        {
            f.mkdirs( ) ;
        }
        else
        {
            this.errLbl2.setText( "A toolbar with the same name already exists." ) ;
            return ;
        }

        //Create icons folder
        File f2 = new File( toolbarFolderPath + "/icons" ) ;
        if( f2.exists( ) == false )
        {
            f2.mkdirs( ) ;
        }
        else
        {
            this.errLbl2.setText( "Toolbar icons folder could not be created." ) ;
            return ;
        }

        //Generate config.xml
        String toolbarConfigPath = toolbarFolderPath + "/config.xml" ;
        String xmlString = this.generateConfigXml( toolbarFolderPath ) ;
        try
        {
            BufferedWriter out = new BufferedWriter( new FileWriter( toolbarConfigPath ) ) ;
            out.write( xmlString ) ;
            out.close( ) ;
        }
        catch( IOException e )
        {
            this.errLbl2.setText( "Could not generate toolbar config file." ) ;
            return ;
        }

        //create LatexToolbar instance
        this.toolbar = new LatexToolBar( this.toolbarNameTxt.getText( ).trim( ), toolbarFolderPath, false ) ;
        ToolBarConfigReader reader = new ToolBarConfigReader( toolbarFolderPath ) ;
        this.toolbar = reader.GenerateButtons( this.toolbar ) ;

        this.tabbedPane.setSelectedIndex( this.tabbedPane.getSelectedIndex( ) + 1 ) ;
    }//GEN-LAST:event_createButtonActionPerformed

    private void backBtn2ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_backBtn2ActionPerformed
        this.tabbedPane.setSelectedIndex( this.tabbedPane.getSelectedIndex( ) - 1 ) ;
    }//GEN-LAST:event_backBtn2ActionPerformed

    private void cancelBtn1ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_cancelBtn1ActionPerformed
        this.dialog.setVisible( false ) ;
    }//GEN-LAST:event_cancelBtn1ActionPerformed

    private void cancelBtn2ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_cancelBtn2ActionPerformed
        this.dialog.setVisible( false ) ;
    }//GEN-LAST:event_cancelBtn2ActionPerformed

    private void cancelBtn3ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_cancelBtn3ActionPerformed
        this.dialog.setVisible( false ) ;
    }//GEN-LAST:event_cancelBtn3ActionPerformed

    private void cancelBtn4ActionPerformed( java.awt.event.ActionEvent evt )
    {//GEN-FIRST:event_cancelBtn4ActionPerformed
        this.dialog.setVisible( false ) ;
    }//GEN-LAST:event_cancelBtn4ActionPerformed

    private ArrayList<LatexButton> latexButtonCollection = new ArrayList<LatexButton>( ) ;

    private LatexToolBar toolbar = null ;

    public LatexToolBar getToolbar( )
    {
        return this.toolbar ;
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea actionDetailTxt ;

    private javax.swing.JButton backBtn1 ;

    private javax.swing.JButton backBtn2 ;

    private javax.swing.JComboBox buttonsCombo ;

    private javax.swing.JButton cancelBtn1 ;

    private javax.swing.JButton cancelBtn2 ;

    private javax.swing.JButton cancelBtn3 ;

    private javax.swing.JButton cancelBtn4 ;

    private javax.swing.JButton createButton ;

    private javax.swing.JButton editActionBtn ;

    private javax.swing.JLabel errLbl ;

    private javax.swing.JLabel errLbl2 ;

    private javax.swing.JLabel errLbl3 ;

    private javax.swing.JPanel generalPanel ;

    private javax.swing.JPanel header1 ;

    private javax.swing.JPanel header2 ;

    private javax.swing.JPanel header3 ;

    private javax.swing.JPanel header4 ;

    private javax.swing.JPanel iconsPanel ;

    private javax.swing.JLabel jLabel1 ;

    private javax.swing.JLabel jLabel2 ;

    private javax.swing.JLabel jLabel3 ;

    private javax.swing.JLabel jLabel4 ;

    private javax.swing.JLabel jLabel5 ;

    private javax.swing.JLabel jLabel6 ;

    private javax.swing.JLabel jLabel7 ;

    private javax.swing.JLabel jLabel8 ;

    private javax.swing.JLabel jLabel9 ;

    private javax.swing.JPanel jPanel1 ;

    private javax.swing.JPanel jPanel2 ;

    private javax.swing.JScrollPane jScrollPane1 ;

    private javax.swing.JScrollPane jScrollPane2 ;

    private javax.swing.JLabel label1 ;

    private javax.swing.JLabel label2 ;

    private javax.swing.JLabel label3 ;

    private javax.swing.JLabel label4 ;

    private javax.swing.JLabel label5 ;

    private javax.swing.JLabel label6 ;

    private javax.swing.JLabel label7 ;

    private javax.swing.JLabel label8 ;

    private javax.swing.JButton newAction ;

    private javax.swing.JButton nextBtn1 ;

    private javax.swing.JButton nextBtn2 ;

    private javax.swing.JButton removeActionBtn ;

    private javax.swing.JLabel resultDetailMessage ;

    private javax.swing.JLabel successMessage ;

    private javax.swing.JPanel summaryPanel ;

    private javax.swing.JTextArea summaryTxt ;

    private javax.swing.JTabbedPane tabbedPane ;

    private javax.swing.JTextField toolbarNameTxt ;
    // End of variables declaration//GEN-END:variables

}
